﻿<Window x:Class="MoneyManagerNET.Presentation.View.ContragentListView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="ContragentWindow" Height="300" Width="300"
        
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d"
        
       xmlns:vm="clr-namespace:MoneyManagerNET.Presentation.ViewModel;assembly=MoneyManagerNET.Presentation.ViewModel" 
       d:DataContext="{x:Static Member=vm:DesignTimeViewModelSupplier.Contragent}"
        
        xmlns:diagnostics="clr-namespace:System.Diagnostics;assembly=WindowsBase"
    >
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="auto" />
            <RowDefinition Height="auto" />
            <RowDefinition Height="auto" />
        </Grid.RowDefinitions>

        <ListBox x:Name="ContragentList" ItemsSource="{Binding Path=ItemsView}" 
                 SelectedValue="{Binding Path=Model}" IsSynchronizedWithCurrentItem="true" >
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <ContentControl DataContext="{Binding .,Converter={StaticResource wrapper}}" >
                        <TextBlock Text="{Binding Path=Name,diagnostics:PresentationTraceSources.TraceLevel=High}"/>
                    </ContentControl>
                </DataTemplate>
            </ListBox.ItemTemplate>
            
        </ListBox>
        <TextBox x:Name="txtName" Grid.Row="1" Margin="4" Text="{Binding Path=Text}" />
        <Grid Grid.Row="2">
            <Grid.ColumnDefinitions>
                <ColumnDefinition/>
                <ColumnDefinition/>
                <ColumnDefinition/>
            </Grid.ColumnDefinitions>
            <Button x:Name="New" Content="Add" Command="{Binding NewCommand}" >
                
            </Button>
            <Button x:Name="Edit" Grid.Column="1" Content="Edit" Command="{Binding EditCommand}" />
            <Button x:Name="Delete" Grid.Column="2" Content="Delete" Command="{Binding DeleteCommand}"/>
        </Grid>
        <Button x:Name="btnSelect" Grid.Row="3" Content="Select" Click="Clicked_Select" />
    </Grid>
</Window>
